package com.gitee.slowcreator.http.util;

import com.gitee.slowcreator.http.params.ScParseResult;
import com.gitee.slowcreator.http.params.ScReturn;

/**
 * @author zxw
 * @date 2023/1/8 下午12:01
 */
public abstract class ScResultUtil {

    /**
     * 请求是否成功
     *
     * @param scReturn
     * @return
     */
    public static boolean requestSuccess(ScReturn scReturn) {

        if (scReturn == null) {
            return false;
        }

        boolean status = scReturn.isSuccess();
        if (!status) {
            return false;
        }

        ScParseResult parseData = scReturn.getParseData();
        if (parseData != null) {
            return parseData.isParseSuccess();
        }

        return true;
    }
}
